<%@ page import="java.io.*,java.util.*,java.sql.*,javax.sql.*,javax.naming.*"%>  
<%@ page contentType="text/html;charset=GB2312"%>  
<html>  
<head><title>DataSourse Connection Test</title></head>  
<body>  
<%  
try{  
    
    java.sql.Connection con;  
    Statement stmt;  
    ResultSet rs;  
    
    Context ctx = new InitialContext();  
    DataSource ds=(DataSource)ctx.lookup("java:/comp/env/jdbc/bbs");
    con=ds.getConnection();  
      
    stmt=con.createStatement();  
    rs=stmt.executeQuery("select * from jndi");  
while(rs.next())  
{  
    out.print(rs.getString(1));   
    out.print(rs.getString(2));  
}  
    rs.close();  
    stmt.close();  
    con.close();    
}  
catch(Exception e)  
{  
    out.print(e.getMessage());  
}   
%>  
</body>  
</html> 